#ifndef __ESP8266_DRIVER_H
#define __ESP8266_DRIVER_H

#include "stm32f1xx_hal.h"

#define ESP8266_UART        huart1
#define ESP8266_BUFFER_SIZE 1024
#define ESP8266_TIMEOUT     2000
#define IP_ADDR "192.168.83.134"
#define ADDR_PATH_DEVICE_DATA "/api/device"
#define ADDR_PATH_KEY "/api/update-keys"
#define ADDR_PATH_STATUS "/api/status"
#define ADDR_PATH_DEVICE_CHANGE "/api/device-change"
#define PORT    3000
#define WIFI_SSID "liuql"
#define WIFI_PASS "12345678"

typedef enum {
    ESP_OK,
    ESP_ERROR,
    ESP_TIMEOUT,
    ESP_NOT_FOUND
} ESP_Status;

void ESP8266_Init(UART_HandleTypeDef *huart);
ESP_Status ESP8266_SendCommand(const char *cmd, const char *expect, uint32_t timeout);
ESP_Status ESP8266_SendData(const uint8_t *data, uint16_t len);
void ESP8266_ReceiveCallback(UART_HandleTypeDef *huart);
void send_encrypted_data(const char * paystr);
void ESP8266_ProcessReceivedData(uint8_t *data);

#endif
